package java44th.group.controller.admin.comments;

import java44th.group.bean.common.BasePageInfo;
import java44th.group.bean.po.MarketComment;
import java44th.group.bean.admin.vo.BaseRespVo;
import java44th.group.service.admin.comment.AdminCommentsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @projectName: project-second
 * @package: java44th.group.controller.admin.comments
 * @className: AdminCommentsController
 * @author: 杨浩祥
 * @description: TODO
 * @date: 2022/10/12 22:08
 * @version: 1.0
 */
@RestController
@RequestMapping("admin/comment")
public class AdminCommentsController {

    @Autowired
    AdminCommentsService commentsService;

    @RequiresPermissions("*")
    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info,Integer userId,Integer valueId){
        // http://182.92.235.201:8083/admin/comment/list?page=1&limit=20&sort=add_time&order=desc
        // {"errno":0,"data":{"total":1076,"pages":54,"limit":20,"page":1,"list":[{"id":1105,"valueId":1181049,"type":0,"content":"sss","adminContent":"测试评论回复","userId":1,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/yfk3juviuswxr9rcrgbe.jpg"],"star":5,"addTime":"2022-09-13 16:51:20","updateTime":"2022-09-13 16:51:20","deleted":false},{"id":1104,"valueId":1033000,"type":0,"content":"123","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 16:11:46","updateTime":"2022-09-13 16:11:46","deleted":false},{"id":1103,"valueId":1181050,"type":0,"content":"1111111","adminContent":"","userId":5,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 13:49:01","updateTime":"2022-09-13 13:49:01","deleted":false},{"id":1102,"valueId":1181050,"type":0,"content":"2222222","adminContent":"","userId":5,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/jztdu40d09ivbyz9l0eu.jpg"],"star":5,"addTime":"2022-09-13 13:42:59","updateTime":"2022-09-13 13:42:59","deleted":false},{"id":1101,"valueId":1181058,"type":0,"content":"lllll","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 12:55:47","updateTime":"2022-09-13 12:55:47","deleted":false},{"id":1099,"valueId":1181013,"type":0,"content":"12345","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 09:55:43","updateTime":"2022-09-13 09:55:43","deleted":false},{"id":1098,"valueId":1181013,"type":0,"content":"很棒","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 09:51:18","updateTime":"2022-09-13 09:51:18","deleted":false},{"id":1097,"valueId":1114011,"type":0,"content":"很好","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":3,"addTime":"2022-09-13 09:47:16","updateTime":"2022-09-13 09:47:16","deleted":false},{"id":1096,"valueId":1181058,"type":0,"content":"看看坎坎坷坷","adminContent":"","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-13 09:37:29","updateTime":"2022-09-13 09:37:29","deleted":false},{"id":1095,"valueId":373,"type":1,"content":"test","adminContent":"","userId":1,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/omxqjepxh651m6nwhzsr.jpg"],"star":5,"addTime":"2022-09-13 02:03:14","updateTime":"2022-09-13 02:03:14","deleted":false},{"id":1094,"valueId":1073008,"type":0,"content":"我觉得非常的棒","adminContent":"俺也一样","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 22:27:27","updateTime":"2022-09-12 22:27:27","deleted":false},{"id":1093,"valueId":375,"type":1,"content":"111111","adminContent":"","userId":5,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 21:55:43","updateTime":"2022-09-12 21:55:43","deleted":false},{"id":1092,"valueId":375,"type":1,"content":"11111","adminContent":"","userId":5,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 21:39:46","updateTime":"2022-09-12 21:39:46","deleted":false},{"id":1091,"valueId":1023003,"type":0,"content":"评价留言","adminContent":"qwe","userId":1,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/3l6nhmjpq8c3qzcs3skb.jpg"],"star":5,"addTime":"2022-09-12 21:29:41","updateTime":"2022-09-12 21:29:41","deleted":false},{"id":1090,"valueId":361,"type":1,"content":"这个苹果很好","adminContent":"","userId":1,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/03tw20qb051xqtmzdmdl.png"],"star":5,"addTime":"2022-09-12 21:21:43","updateTime":"2022-09-12 21:21:43","deleted":false},{"id":1089,"valueId":1181059,"type":0,"content":"goods部分的留言","adminContent":"","userId":1,"hasPicture":true,"picUrls":["http://182.92.235.201:8083/wx/storage/fetch/e74srh7ffvnorv3a23jv.jpg"],"star":5,"addTime":"2022-09-12 21:18:59","updateTime":"2022-09-12 21:18:59","deleted":false},{"id":1087,"valueId":373,"type":1,"content":"ad","adminContent":"123","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 19:39:13","updateTime":"2022-09-12 19:39:13","deleted":false},{"id":1086,"valueId":1181074,"type":0,"content":"wwww","adminContent":"12121","userId":1,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 17:54:02","updateTime":"2022-09-12 17:54:02","deleted":false},{"id":1085,"valueId":1181075,"type":0,"content":"1111","adminContent":"","userId":5,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 16:22:12","updateTime":"2022-09-12 16:22:12","deleted":false},{"id":1084,"valueId":1055016,"type":0,"content":"123gzm","adminContent":"","userId":2,"hasPicture":false,"picUrls":[],"star":5,"addTime":"2022-09-12 16:05:35","updateTime":"2022-09-12 16:05:35","deleted":false}]},"errmsg":"成功"}
        BaseRespVo baseRespVo = commentsService.list(info,userId,valueId);
        return baseRespVo;
    }

    @RequiresPermissions("*")
    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody MarketComment marketComment){
        BaseRespVo baseRespVo = commentsService.deleted(marketComment);
        return baseRespVo;
    }

}
